//
//  SHNetWorkingTool.m
//  UI_CarHome
//
//  Created by dllo on 15/10/29.
//  Copyright (c) 2015年 沈浩. All rights reserved.
//

#import "SHNetWorkingTool.h"
#import "SHHandle.h"
@implementation SHNetWorkingTool

+ (void)getNetWorking:(NSString *)strURL block:(Block)block
{
    
    NSURL *url = [NSURL URLWithString:strURL];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
    // 设置缓存策略
    request.cachePolicy = NSURLRequestReturnCacheDataElseLoad;
    
    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        if (data) {
            id result = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
            block(result);
        }
        
      
        }];
}
@end
